package ooday04;

import java.util.Timer;
import java.util.TimerTask;

/**
 * @author Huangjin
 * @version 1.0
 * describe:定时器
 * @date 2023/2/24 15:47
 */
public class TimerDemo {
    public static void main(String[] args) {
        /*
        //定时器对象
        Timer timer = new Timer();
        //定时间隔（一毫秒为单位）
        int interval = 1000;
        //定时计划表
        timer.schedule(new TimerTask() {
            //定时干的事--------每1000毫秒自动执行
            @Override
            public void run() {
                System.out.println("该敲代码了！！！");
            }
        },5000,1000);*/
        Timer timer = new Timer();
        int interval =1000;
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("开始了");
            }
        },interval,interval);
    }
}
